<template>
    <el-select v-model="supplier" style="width: 200px;" multiple clearable collapse-tags placeholder="请选择要发送的供应商" filterable>
        <el-option v-for="(item,index) in supplierList" :key="`supplier-item-${index}`" :label="item.work_name" :value="item.id" value-key="item.id"></el-option>
    </el-select>
</template>
<script>
export default{
    data(){
        return{
            supplier:[],
            supplierList:[]
        }
    },
    props:{
        value:Array
    },
    watch:{
        value: {
            deep: true,
            immediate: true,
            handler:function(){
                this.supplier = this.value
            }
        },
        supplier(){
            this.$emit('input',this.supplier)
        }
    },
    created(){
        this.getSupplier()
    },
    methods:{
        async getSupplier(){
            let res = await this.$get({
                url:'/admin/customer.Supplier/index',
            })
            this.supplierList = res.data
        }
    }
}
</script>
